package com.ocom.human.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import com.ocom.common.entity.access.EntityPersonnelYkm;
import com.ocom.common.enums.DataSourceEnum;
import com.ocom.human.dao.IDaoPersonnelYkm;
import com.ocom.human.service.PersonnelYkmService;
import com.ocom.mysql.aspect.DataSourceAspect;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class PersonnelYkmServiceImpl extends ServiceImpl<IDaoPersonnelYkm, EntityPersonnelYkm> implements PersonnelYkmService {

    @Autowired
    private IDaoPersonnelYkm iDaoPersonnelYkm;

    //根据人员信息的comId+pId查询防疫监控信息表personnel_ykm
    @DataSourceAspect(type = DataSourceEnum.PART_DB,companyId = "comId")
    @Override
    public EntityPersonnelYkm GetPersonnelYkm(Long comId, Long pId) {
        QueryWrapper<EntityPersonnelYkm> query = Wrappers.query();
        query.eq("com_id",comId);
        query.eq("p_id",pId);
        return iDaoPersonnelYkm.selectOne(query);
    }
}
